//
//  NNAlertListController.swift
//  CommonTool
//
//  Created by tenroadshow on 24.1.22.
//

import UIKit

class NNAlertListController: UIViewController {

    
    lazy var imgView: UIImageView = {
        let img = UIImageView(frame: .zero)
        img.image = UIImage(named: "cat")
        return img
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        
        let item0 = UIBarButtonItem(title: "one",
                                   style: .done,
                                   target: self,
                                   action: #selector(showAlert0))
        
        let item1 = UIBarButtonItem(title: "two",
                                   style: .done,
                                   target: self,
                                   action: #selector(showAlert1))

        
        navigationItem.rightBarButtonItems = [item0, item1]
        
        view.addSubview(imgView)
        imgView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    

    
    @objc func showAlert0() {
        NNAlertViewController.show(title: "再次强调再次强调再次强调",
                                   message: "再次强调：中高风险地区的就不要回来了") { style in
            
        } actionHandle: { isOk in
            print("======== \(isOk ? "ok" : "cancel")")
        }
    }
    @objc func showAlert1() {
        NNAlertViewController.show(title: "提示",
                                   message: "再次强调：中高风险地区的就不要回来了") { style in
            
            style.isDoubleBtn = true
        } actionHandle: { isOk in
            print("======== \(isOk ? "ok" : "cancel")")
        }
    }
}


